home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / examples / exam06 / main.c < prev    next >
C/C++ Source or Header  |  1995-09-27  |  2KB  |  111 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6. /*
  7.  *
  8.  *    This source code is CONFIDENTIAL and
  9.  *    PROPRIETARY to Algorithms Corporation. Unauthorized
  10.  *    distribution, adaptation or use    may
  11.  *    be subject to civil and    criminal penalties.
  12.  *
  13.  *    Copyright (c) 1993 Algorithms Corporation
  14.  *    3020 Liberty Hills Drive
  15.  *    Franklin, TN  37064
  16.  *
  17.  *    ALL RIGHTS RESERVED.
  18.  *
  19.  *
  20.  *
  21.  */
  22.  
  23.  
  24.  
  25. #include "generics.h"
  26.  
  27.  
  28. main(int argc, char *argv[])
  29. {
  30.     object    strDict;
  31.  
  32.  
  33.     InitDynace(&argc);
  34.  
  35.  
  36.     /*  Create a new StringDictionary to hold roughly 49 elements.
  37.         Note that although the dictionary is set up to hold roughly 49
  38.         elements, it may actually hold any number,  it's just that
  39.         the effeciency of the dictionary will start to go down at
  40.         arount 49 elements.  */
  41.  
  42.     strDict = gNewWithInt(StringDictionary, 49);
  43.  
  44.  
  45.     /*  Print the entire link object out  */
  46.  
  47.     gPrint(strDict, stdoutStream);
  48.  
  49.  
  50.     /*  Add a new object to the dictionary and print  */
  51.  
  52.     gAddStr(strDict, "Key 1", gNewWithStr(String, "The first value added."));
  53.     gPrint(strDict, stdoutStream);
  54.  
  55.  
  56.     /*  Add a new object to the beginning of the list and print */
  57.  
  58.     gAddStr(strDict, "Other key", gNewWithDouble(DoubleFloat, 3.14159));
  59.     gPrint(strDict, stdoutStream);
  60.  
  61.     /*  Add a new object to the end of the list and print */
  62.  
  63.     gAddStr(strDict, "abcd", gNewWithLong(LongInteger, 186282L));
  64.     gPrint(strDict, stdoutStream);
  65.  
  66.  
  67.     /*  Find and print the value associated with "Other key" */
  68.  
  69.     gPrint(gFindValueStr(strDict, "Other key"), stdoutStream);
  70.  
  71.  
  72.     /*  Dispose of one of the key/value pairs and print dictionary */
  73.  
  74.     gDeepDisposeStr(strDict, "Key 1");
  75.     gPrint(strDict, stdoutStream);
  76.  
  77.  
  78.     /*  Dispose of the entire link object and all objects held  */
  79.     /*  (again only necessary of garbage collector not used)    */
  80.  
  81.     gDeepDispose(strDict);
  82.     
  83.     
  84.     return 0;
  85. }
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. /*
  94.  *
  95.  *    This source code is CONFIDENTIAL and
  96.  *    PROPRIETARY to Algorithms Corporation. Unauthorized
  97.  *    distribution, adaptation or use    may
  98.  *    be subject to civil and    criminal penalties.
  99.  *
  100.  *    Copyright (c) 1993 Algorithms Corporation
  101.  *    3020 Liberty Hills Drive
  102.  *    Franklin, TN  37064
  103.  *
  104.  *    ALL RIGHTS RESERVED.
  105.  *
  106.  *
  107.  *
  108.  */
  109.  
  110.  
  111.